<template>
  <div class="user-info" @click="goUserDetailPage">
    <div class="user-info__left">
      <img size="60" :src="userInfo.avatarUrl" alt="" />
    </div>
    <div class="user-info__right">
      <div class="user-info__top">
        <div class="name">{{ userInfo.nickName }}</div>
        <nut-icon name="edit"></nut-icon>
      </div>
      <div class="desc">普通用户</div>
    </div>
  </div>
</template>

<script lang="ts" setup>
import Taro from '@tarojs/taro'
import { computed } from 'vue'
import { useStore } from '@/stores'

const auth = useStore('auth')
const userInfo = computed(() => auth.userInfo)

const goUserDetailPage = () => {
  Taro.navigateTo({ url: '/pages/my/detail/index' })
}
</script>

<style lang="scss">
@import '@/assets/styles/index.scss';
.user-info {
  display: flex;
  padding: 25px 10px 15px 10px;
  position: relative;
  border-radius: 4px;
  color: #fff;
  overflow: hidden;
  &__left {
    width: 60px;
    height: 60px;
    overflow: hidden;
    border-radius: 50%;
    overflow: hidden;
    background: #fff;
    img {
      width: 60px;
      height: 60px;
      vertical-align: middle;
    }
  }
  &__right {
    flex: 1;
    padding: 0 0 0 10px;
    span {
      max-width: 100px;
    }
  }
  &__top {
    padding-top: 10px;
    @include multi-ellipsis(1);
    display: flex;
    align-items: center;
    height: 20px;
  }
  .name {
    font-size: 22px;
    @include multi-ellipsis(1);
    max-width: 160px;
  }
  .nut-icon-edit{
    margin-left: 5px;
    font-size: $font-size-0;
  }
  .desc {
    padding-top: 8px;
    font-size: $font-size-1;
    opacity: 0.9
  }
}
</style>
